package com.lmscn.lms.api.model;

import com.jfinal.plugin.activerecord.Model;

/**
 * Created by quxingyu on 2015/8/10.
 */
public class SysProperties extends Model<SysProperties> {
    public static final SysProperties dao = new SysProperties();

    /**
     * 根据属性名称获取系统设置对象
     * @param  name 系统参数名称
     * */
    public int getSysPropertiesByName(String name){
        SysProperties sysProperties = dao.findFirst("select t.* from sys_properties t where t.name = ? ",name);
        int returnValue = 0;
        try {
            returnValue = Integer.parseInt(sysProperties.getStr("value"));
        }catch (Exception e){

        }
        return returnValue;
    }
    public SysProperties findByName(String name){
        return dao.findFirst("select t.* from sys_properties t where t.name = ? ",name);
    }

}
